package com._21cn.product.web.validator;

import com._21cn.product.entity.CarBusinessNew;
import com._21cn.framework.utils.StringUtil;
import com.sun.org.apache.xpath.internal.operations.String;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

@Component("carBusinessNewValidator")
public class CarBusinessNewValidator implements Validator {

    public boolean supports(Class<?> clazz) {
        return CarBusinessNew.class.equals( clazz );
    }

    public void validate(Object target, Errors errors) {
        CarBusinessNew obj = (CarBusinessNew)target;
        if( obj.getTotalPrice() == null ){
            errors.rejectValue( "totalPrice", "error.path", "总价不能为空" );
        }
    }
}